﻿@{
    Layout = "~/Views/Shared/_Layout.cshtml";
    string lang = (Session["Language"] == null) ? "vi" : Session["Language"].ToString();
}
@section script_arena
{
<script>
    maxLength = '@ViewBag.nTours';

    function pageselectCallback(page_index, jq) {
        // Get number of elements per pagionation page from form
        var items_per_page = 5;
        var max_elem = Math.min((page_index + 1) * items_per_page, maxLength);

        $.ajax({
            url: '@Url.Action("SearchTourPager", "Tours")',
            cache: false,
            data: { "pageNumber": page_index + 1, "pageSize": items_per_page, "keyword": '@ViewBag.keyword', "type": '@ViewBag.type', "min": '@ViewBag.min', "max": '@ViewBag.max' },
            success: function (data) {
                $("#products-list").hide().fadeTo('slow', 1).html(data).fadeIn('slow');
            }
        });

        // Prevent click eventpropagation
        return false;
    }
    function getOptionsFromForm() {
        var opt = { callback: pageselectCallback };
        opt.items_per_page = 5;
        opt.num_display_entries = 10;
        opt.num_edge_entries = 2;
        return opt;
    }
    $(document).ready(function () {
        // Create pagination element with options from form
        var optInit = getOptionsFromForm();
        $("#Pagination").pagination(maxLength, optInit);
    });
    </script>
}
@section tourArea1
{
<h2 class="subtitle">@ViewBag.Title</h2>
<div class="pager">
    <p class="amount"><strong>@ViewBag.nTours tour(s)</strong></p>
    <div class="limiter">
    <div id="Pagination" class="pagination"></div>
    </div>
</div>

<div style="clear:both"></div>
<ol class="products-list" id="products-list"></ol>
}

